import 'package:flutter/material.dart';

class TestPage extends StatefulWidget {
  const TestPage({Key key}) : super(key: key);

  @override
  _TestPageState createState() => _TestPageState();
}

class _TestPageState extends State<TestPage>
    with SingleTickerProviderStateMixin {
  double th = 100;
  AnimationController _animationController;

  @override
  void initState() {
    _animationController =
        AnimationController(duration: const Duration(seconds: 2), vsync: this);
    super.initState();
    _animationController.addStatusListener((status) {});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add),
        onPressed: () {
          setState(() {
            th == 100 ? th = 200 : th = 100;
          });
          _animationController.forward();
        },
      ),
      body: Center(
        child: ScaleTransition(
          alignment: Alignment.center,
          scale: _animationController,
          child: Container(
            color: Colors.red,
            height: 300,
            width: 100,
          ),
        ),
      ),
    );
  }
}
